package com.cet.designpatterns.interpreter.cc;

/**
 * @program: algorithm
 * @description:
 * @author: 陈恩涛
 * @create: 2021-09-26 11:09
 **/
public class NonterminalExpression implements  Expression {

    private Expression city;
    private Expression personGroup;

    public NonterminalExpression(Expression city, Expression personGroup) {
        this.city = city;
        this.personGroup = personGroup;
    }

    @Override
    public boolean interpret(String info) {
        String[] s = info.split("的");
        return city.interpret(s[0]) && personGroup.interpret(s[1]);
    }
}
